<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // Dog是一个类，是抽象
    class Dog {
      constructor (name) {
        this.name = name
      }
      say () {
        console.log(`My name is ${this.name}`)
      }
    }
    // new Dog得到snoopy这个实例，实例就可以调用方法了
    var snoopy = new Dog('Snoopy')
    snoopy.say()

  </script>
</body>
</html>